<!DOCTYPE HTML>
<?php 
	session_start(); 
	
	if(isset($_SESSION['id'], $_SESSION['vorname'], $_SESSION['name'])){
		$id = $_SESSION['id'];
		$vorname = $_SESSION['vorname'];
		$name = $_SESSION['name'];
	}

    function RankName() {
        $sql = "USE web_db";
        $link = mysqli_connect('localhost', 'root', '') or die("Failed to connect to MySQL: " . 
                mysql_error());
        $result = mysqli_query($link,$sql);

        $sql = "SELECT workstation FROM rank WHERE rank_nr=".$_SESSION['workstation'];
        $result = mysqli_query($link,$sql);

        $row = mysqli_fetch_row($result);
        echo $row[0];
    }
?>
<html>

<head>
<title>About us</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link href='./images/favicon.ico' rel='shortcut icon' type='image/png'>
<link rel="stylesheet" type="text/css" href="./css/index.css">
</head>


<body id="fondo">
<div id="cuerpo">
<fieldset style="width: 1000px; color: #FFF;";>
    <?php
        include 'header.php';
    ?>
	<div id="subcuerpo">
    	<table>
        <tr>
        	<td id="principal"><h2>About us</h2></td>
			<?php if(isset($_SESSION['id'], $_SESSION['vorname'], $_SESSION['name'])) : ?>
			<td id="logged"><h2>Welcome back, <?php RankName(); echo " ".$vorname?></h2></n>
            				<table id="logout">
                				<tr><form method="POST" action="log_out.php">
								</tr>
                                <tr><td></td><td><input type="submit" name="submit" value="Logout"></td>
                				</form></tr>
                				</table></td>
			<?php else : ?>
            <td id="submenu"><h2>Log in</h2></n>
            				<table id="login">
                				<tr><td><form method="POST" action="login.php">ID: </td><td><input type="text" name="id"></td>
                				</tr>
                				<tr><td>Password: </td><td><input type="password" name="pwd"></td>
                                <tr><td></td><td><input type="submit" name="submit" value="Log in"></td>
                				</form></tr>
                				</table></td>
			
			<?php endif; ?>
        </tr>
        <tr>
        	<td>The Lifestream courses through our Planet back and forth across the 
        		borders of life and death. If that cycle is the very truth of life then history,
        		 too, will inevitably repeat itself. So go on - bring your Mechas and your 
        		 High-Tech weapons. It won't matter. We'll do as life dictates and stop you every 
        		 single time.</td>
        </tr>
        </table>
    </div>
<?php
    include 'footer.php';
?>
</fieldset>
</div>
</body>